<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>来登录吧</title>
<link rel="stylesheet" href="css/layout.css" type="text/css" />
<link rel="stylesheet" href="css/login_layout.css" type="text/css" />
<script type="text/javascript" src="js/jquery_1.7.1.js"></script>

</head>


<body>
  <div id="container">
    <div id="header">
	  <div id="logo">
	    <img src="images/city1.jpg" width="400px" height="100px" alt="logo" />
	  </div>
	</div>
	
	<div id="main">
	  <div id="left">
	    <img src="images/logocity.jpg" width=570px height="500" alt="cityPic"  />
	  </div>
	  
	  <div id="right">
	    <p>还没有账户？</p>
		<p id="create" style="text-align:center;"><a href="#">Go，创建一个！</a></p>
		<hr />
		<p>登录</p>
		<?php   //这段php是提交后才会运行，处理提交数据的。
		require_once(dirname(__FILE__)."/../include/httpclient.php");
		
		if( isset($_POST['username']) && isset($_POST['password']) ) //用户提交以后走这个分支
		{
			if($_POST['username']=='')
			  echo '<div id="warning"><img src="images/24.gif" style="float:left; margin-top:2px; margin-left:5px; margin-right:5px;"/><p>请输入您的用户名</p></div>';
			else if($_POST['password']=='')
			  echo '<div id="warning"><img src="images/24.gif" style="float:left; margin-top:2px; margin-left:5px; margin-right:5px;"/><p>请输入您的密码</p></div>';
			else //用户名密码都不为空
			{
				//验证这个用户名密码正不正确
				$arg=array( 'act' => 'check_user_login',
					        'username' => $_POST['username'],
					        'password' => md5($_POST['password'])
					      );
				$r = call_serviceurl(20,  $arg);
				
				if( $r == true ) //验证成功，登录成功
				{
					session_start();
		
					$_SESSION['name'] = $_POST['username'];

					header("Location: ./user_space.php");
				}
				else //验证失败，登录失败
				{
					echo '<div id="warning"><img src="images/24.gif" style="float:left; margin-top:2px; margin-left:5px; margin-right:5px;"/><p>用户名或密码错误，请重新输入</p></div>';
				}

			}
		}
		else echo '';
		?>
		
		<form name="login" action="user_login.php" method="post">
          <p>用户名：</p><input type="text" name="username" />
          <br /><br />
          <p>密码：</p><input type="password" name="password" />
		  <br /><br />
		  <input style="margin-left:50px;" type="submit" value="登录" /><a href="#" style="font-size:12px; margin-left:20px;">忘记密码？</a>
        </form>
		<hr />
		<p style="font-size:12px;">也可以用合作网站帐号登录：</p>
		<div id="cooperation">
		  <img src="images/tencentpay.png" /> <img src="images/alipay2.png" />
		</div>
	  </div>
	  
	</div>
	
	
	<div id="footer">
	</div>

  </div>
</body>

</html>


<script type="text/javascript">
function judgeCookie()
{
	var isCookie=navigator.cookieEnabled?true:false;
	if( ! isCookie )//说明浏览器cookie未启动
		alert( "您浏览器的 cookie 功能被禁用，请启用此功能。" );
}
window.onload = judgeCookie();

</script>